using Microsoft.SharePoint;
using Sapphire.Linq.FieldMaps;
using Sapphire.Linq.Framework;

namespace Sapphire.Linq.Tests.DataContext
{
    public class TasksDataContext : LinqQueryProvider
    {
        public TasksDataContext(string url)
            : base(url)
        {
        }

        public TasksDataContext(SPWeb web)
            : base(web)
        {
        }

        public override void InitMaps(IPropertyMapsContext mapsContext)
        {
            mapsContext
                .Register(Tasks)
                    .SetAllAuto()
                    .But(t => t.ID, SPBuiltInFieldId.ID)
                    .But(t => t.Title123, "Title");
        }

        public ListQuery<Task> Tasks
        {
            get
            {
                return GetList<Task>("Lists/Tasks");
            }
        }

        public ListQuery<Item> Items
        {
            get
            {
                return GetList<Item>("Lists/Custom1");
            }
        }
    }
}